//
//  Home.swift
//  HeroAnimation
//
//  Created by qingzhou on 2021/5/13.
//

import SwiftUI

struct Home: View {
    @EnvironmentObject var profileData:ProfileDetailModel
    var animation: Namespace.ID
    var body: some View {
        ScrollView(.vertical, showsIndicators: false) {
            VStack(alignment: .leading, spacing: 15, content: {
                Text("Hero动画")
                    .font(.title)
                    .fontWeight(.bold)
                    .foregroundColor(.black)
                    .frame(maxWidth: .infinity, alignment: .leading)
                    .padding()
                    .padding(.top,50)
                ForEach(recents){ recent in
                    RecentRowView(recent: recent, animation: animation)
                }
            })
        }
        .overlay(
            ZStack {
                if profileData.showProfile {
                    ProfileDetailView(animation: animation)
                }
            }
        )
    }
}

struct Home_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
